package com.zztl.infiniteBand.adapter

import android.os.Trace

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.zztl.infiniteBand.R
import com.zztl.infiniteBand.model.LanguageBean

/**
 * @author swl
 * date 2019/8/12 16:20
 */
class LanguageAdapter(layoutResId: Int, data: List<LanguageBean>?) : BaseQuickAdapter<LanguageBean, BaseViewHolder>(layoutResId, data) {

    override fun convert(helper: BaseViewHolder, item: LanguageBean) {
        val index = data.indexOf(item)
        helper.setText(R.id.tv_language, item.language)
                .setImageResource(R.id.iv_choose, if (item.isChoosed) R.mipmap.choosed else R.mipmap.unchoosed)
                .setVisible(R.id.line, index != data.size - 1)

    }
}
